﻿CREATE PROCEDURE [dbo].[GetAdressenListe]
	@inOrgKey int = 0
AS
begin
	declare @retAdressID uniqueidentifier = (select NEWID())

	SELECT 
		ISNULL(a.AdressID, @retAdressID ) 'AdressID',
		ISNULL(a.AdressType, '') 'AdressType',
		ISNULL(a.Ort,'') 'Ort',
		ISNULL(a.OrgKey,0) 'OrgKey',
		ISNULL(a.Postleitzahl, '') 'Postleitzahl',
		ISNULL(a.Straße,'') 'Straße'
	from dbo.Adressen a
	where a.OrgKey = @inOrgKey
	
	RETURN 0
end
GO
GRANT EXECUTE
    ON OBJECT::[dbo].[GetAdressenListe] TO PUBLIC
    AS [dbo];

